<template>
  <div class="box">
    {{ $store.state.title }}
    <p>{{$store.state.count}}</p>
    <button @click='handleAdd(5)'>点击数字++</button>
  </div>
</template>

<script>
export default {
  name: 'SonName1',
  methods: {
    handleAdd (n) {
      console.log(this.$store.state.count)
      this.$store.commit('addCount', n)
    }
  }
}
</script>
<style lang="less" scoped>
  .box{
    width: 300px;
    height: 300px;
    margin: 0 auto;
    background-color: pink;
    border: 1px solid black;
  }

</style>
